PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I've currently set up a pagination but I can't seem to figure out how I can limit the links shown because an overload of data crowds the pagination navigation. If there's over 30 pages, the pagination navigation looks way too cluttered. How can I adjust my current code so after 5 pages there's an ellipsis (...) and the link to the very last page after the ellipsis. Kind of like the way this forum's pagination is set up.
You know how many total pages there are, and you know the current page being displayed. Let's say you want links to five pages. If $current_page + 2 < 5, display the first five pages. If $current_page + 2 > $total_pages, display the last five pages. Otherwise, display $current_page - 2 through $current_page + 2. Or something to that effect.