Simple pagination (Pure PHP)
Used Faker for test function with fake datas. Remove related lines if you don't want to use Faker.
This project can help you to manage pages and listing items. It won't get items from Database or something else, you need to get those values and pass it to the function.
paginate function returns the list of pages you need.
Check values before pass the function to prevent fatal errors.
Try to keep $maxPaginationItems in odd numbers to center items properly.
use Pagination\Pagination; echo Pagination::paginate($currentIndex, $itemsPerPage, $totalItems, $maxPaginationItems, $link);