I also have suggestion about the pageChk function to make it less complicated / faster. Could you check if my suggestion is correct? The current function:
function pageChk($page,$numRows,$viewMax){
if($numRows>0 and ($page>PAGE1_OFFSET+1 or $page<PAGE1_OFFSET+1)){
$max=ceil($numRows/$viewMax)+PAGE1_OFFSET;
if ($page<PAGE1_OFFSET+1) return PAGE1_OFFSET+1;
elseif($page>$max) return $max;
else return $page;
}
else return PAGE1_OFFSET+1;
}
My proposed function:
function pageChk($page,$numRows,$viewMax){
if($numRows>0 and $page>PAGE1_OFFSET+1){
$max=ceil($numRows/$viewMax)+PAGE1_OFFSET;
if($page>$max) return $max;
else return $page;
}
else return PAGE1_OFFSET+1;
}