PHP Pagination - Navigation Improvement
// If over 6 pages away from the first page, add a quick link to the first page | |
if ($page_number > 6) { | |
$paginationCtrls .= '<a href="' . $_SERVER['PHP_SELF'] . '/page/1">1</a> ... '; | |
} | |
// If over 5 pages away from the last page, add a quick link to the last page | |
if ($page_number < $last_page - 5) { | |
$paginationCtrls .= ' ... <a href="' . $_SERVER['PHP_SELF'] . '/page/' . $last_page . '">' . $last_page . '</a> '; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment