';
$key.="
$page/$pages "; //Which page, how many pages in total
if($page!=1){
$key.= "
First page "; //First page
$key.="< a href="".$_SERVER['PHP_SELF']."?page=".($page-1)."">Previous page"; //Previous page
} else {
$key.="First page";//First page
$key.="Previous page"; //Previous page
}
if($pages> $page_len){
//If the current page is less than or equal to the left offset
if($page<=$pageoffset){
$init=1;
$max_p = $page_len;
}else{//If the current page is greater than the left offset
//If the right offset of the current page number exceeds the maximum number of pages
if($page+$pageoffset>=$pages+1){
$init = $pages-$page_len+1;
}else{
//Calculation when both left and right offsets exist
$init = $page-$pageoffset;
$max_p = $page+$pageoffset ;
}
}
}
for($i=$init;$i<=$max_p;$i++){
if($i==$page){
$key.='
'.$i.'';
} else {
$key.="
".$i."";
}
}
if($page!=$pages){
$key.="
Next page " ;//Next page
$key.="
Last page" ; //Last page
}else {
$key.="Next page"; //Next page
$key.="Last page"; //Last page
}
$key.='
';