public static function getPagination()
{
if (self::getPaging() == false) {
return null;
}
$page = self::getCurrentPage();
$total_of_pages = self::getTotalOfPages();
$nave = '<div class="pagination">';
if ($page != 1) {
$nave .= '<a class="first" href="' . self::buildPaginator('1') . '">' . self::$buttons['first'] . '</a>';
} else {
$nave .= '<a class="first nolink">' . self::$buttons['first'] . '</a>';
}
if ($page != 1 && $total_of_pages > 0) {
$nave .= '<a class="previous" href="' . self::buildPaginator($page - 1) . '">' . self::$buttons['previous'] . '</a>';
} else {
$nave .= '<a class="previous nolink">' . self::$buttons['previous'] . '</a>';
}
if ($total_of_pages == 0) {
$nave .= '<a class="selected">1</a>';
} else {
for ($x = 1; $x <= $total_of_pages; $x++) {
if ($page == $x + 3) {
$nave .= '<a href="' . self::buildPaginator($x) . '">' . $x . '</a>';
}
if ($page == $x + 2) {
$nave .= '<a href="' . self::buildPaginator($x) . '">' . $x . '</a>';
}
if ($page == $x + 1) {
$nave .= '<a href="' . self::buildPaginator($x) . '">' . $x . '</a>';
}
if ($page == $x) {
$nave .= '<a class="selected">' . $x . '</a>';
}
if ($page == $x - 1) {
$nave .= '<a href="' . self::buildPaginator($x) . '">' . $x . '</a>';
}
if ($page == $x - 2) {
$nave .= '<a href="' . self::buildPaginator($x) . '">' . $x . '</a>';
}
if ($page == $x - 3) {
$nave .= '<a href="' . self::buildPaginator($x) . '">' . $x . '</a>';
}
}
}
if ($page < $total_of_pages) {
$nave .= '<a class="next" href="' . self::buildPaginator($page + 1) . '">' . self::$buttons['next'] . '</a>';
} else {
$nave .= '<a class="next nolink">' . self::$buttons['next'] . '</a>';
}
if ($page != $total_of_pages && $total_of_pages > 0) {
$nave .= '<a class="last" href="' . self::buildPaginator($total_of_pages) . '">' . self::$buttons['last'] . '</a>';
} else {
$nave .= '<a class="last nolink">' . self::$buttons['last'] . '</a>';
}
$nave .= '</div>';
return $nave;
}