php calculation solution for pagination
<p>I have a variable <code>$total</code> which is the total number of results and <code>$page</code> which is the page number. The result is limited to 12 per page. </p>

<p>Suppose if <code>$total</code> is 24, the script may return 1 and 2 for <code>$page</code>=1 and <code>$page</code>=2 respectively. It should also return 1 if the input number is less than 1 (negative or zero) or if the number is greater than 2</p>

<p>Again, suppose if <code>$total</code> is 25, the script may return 1, 2 and 3 for <code>$page</code>=1, <code>$page</code>=2 and <code>$page</code>=3 respectively. It should also return 1 if the input number is less than 1 (negative or zero) or if the number is greater than 1</p>
