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