This is one way to do it (It creates something like [1-10][11-20][21-30]), but you can modify it if you want.
function makeLinks($cur, $inc, $total, $q){
// This function is recursive.
// $cur - The current number of the item you're on.
// $inc - The number that the counted links will be incremented
// $total - The total number that will be created
// $q - This script was used in conjunction with a search engine, and $q is the search query. You can replace this with whatever you wanted to link to.
if($cur + $inc < $total){
print("[<a href=\"search.php?action=search&cur=" . $cur . "&q=" . $q . "\">" . $cur . "-" . ($cur + $inc - 1) . "</a>] ");
makeLinks($cur + $inc, $inc, $total, $q);
}
else{
print("[<a href=\"search.php?action=search&cur=" . $cur . "&q=" . $q . "\">" . $cur . "-" . ($total-1) . "</a>] ");
}
}