rajdeeppaul/pagination ? reverse-engineered prompt
Reverse engineered prompt
Build me a simple PHP pagination helper I can drop into a project without using JavaScript or any jQuery plugin.
I want to include one file, create a Pagination object with either MySQLi or PDO, set how many rows to show per page and how many page links to display, then call it with a SELECT query and $_GET so it reads a page value from the URL and automatically handles the right LIMIT and OFFSET. It should work with normal queries and also with queries that use bound values, and it should return the rows for the current page plus a separate set of previous and next pagination links.
Make it easy to use with a small example page that shows how to loop through the results and print the page links. Keep the code clean and generic so it can be reused with different tables and queries, and make sure it does not require me to add pagination logic into every SQL query myself. If you need to check anything, look up current docs online.
Are you gonna build this?
make sure you review the code using coderabbit