$page = 1;
$total = 20;
$prevs = $page - 4;
if($prevs
$prevs = 1;
}
$ next = $page + 4;
if($next > $total) {
$next = $total;
}
for($i = $prevs; $i
echo $i."rn";
}
echo '['.$page.']'."rn";
for($i = $page + 1; $i < ;= $next; $i++) {
echo $i."rn";
}