public static function pageNav($total_num, $on_page, $diapason, $url){
if(isset($_GET['start'])){
$start=abs(intval($_GET['start']));
} else {
$start=0;
}
$max_page=ceil($total_num/$on_page);
$current_page=round(($start/$on_page), 0);
if(($current_page-$diapason)>-1) echo'<a href="' . $url . '">1...</a> ';
for($i=-($diapason-1);$i<$diapason;$i++){
$go=$current_page+$i;
if($go<0||($go+1)>$max_page) continue;
if($go==$current_page){
echo'<b>[' . ($go+1) . ']</b> ';
continue;
}
echo'<a href="' . $url . ((substr_count($url, '?')>0)?'&start=':'?start=') . ($go*$on_page) . '">' . ($go+1) . '</a> ';
}
if(($current_page+$diapason)<$max_page) echo'<a href="' . $url . ((substr_count($url, '?')>0)?'&start=':'?start=') . ($max_page*$on_page) . '">...' . $max_page . '</a> ';
}