The idea:
I call "GetNumberOfPages(Instance $Number of items)"
and it returns the number of items I sent it.
function GetNumOfPages($rows) {
$max = 5;
$pgs = $rows;
$ps = 1;
$a = 0;
echo "<!-- while ($pgs > $max) { -->";
while($pgs > $max) {
$a++;
echo "<!-- $a -->";
if($a == $max) {
$ps++;
}
$pgs = $pgs -1;
}
return $ps;
}