Function
[man]range[/man] returns a sequence of numbers
Like this you could do.
You can change $max to any number
<?php
// range(1, 5) will return: array(1,2,3,4,5)
$max = 5;
foreach( range(1,$max) as $num ) {
echo '<a href="index.php?page='.$num.'">Page '.$num.'</a>';
echo '<br />';
}