It looks much more better. We are making progress. Thanks.
The missing point here is that we should add the retrieving data part from the model and tell the users to keep them seperated.
For instance,
PHP Code:
$data['offers_pending'] = $this->AdminLib->OfferModel->get_all_offers_pending();
This is nothing to do with the pagination code of yours below:
PHP Code:
$pager = service('pager');
$count = $model->where('offer_status', 'pending')->countAllResults(); //I have added this
$page = (int) ($this->request->getGet('page') ?? 1);
$perPage = 2;
$total = $count; // or $count/$perPage or 10 as you typed
// Call makeLinks() to make pagination links.
$pager_links = $pager->makeLinks($page, $perPage, $total);
$data['pager_links'] = $pager_links;
But the thing I face here is the
$total variable. It is not usable. Because imagine
the total is 6 and I have 3 results per page for 10 results. Then after the second or third pagination it keeps showing the same, the last, item for the rest of the paginations.