I have a search result from MySQL query or Array
or something else. The result gave a variable $totalfiles
say for example 25. The number of results is limited to $limit
, here 12
. The maximum number of pages calculated, $maxpages
, will be 3
.
As we consider the case, we will get 12 results for pages 1 and 2, and 1 for page 3.
What is the easiest way to predict (or calculate) the number of results in a specific page using variables $totalfiles
, $limit
, $maxpages
and $pagenumber
using PHP? I don't think all these 4 variables are necessary for doing this.