1$count = 7; // number to show
2// start at half threshold down from the current location.
3$number = $current - round($count/2);
4if( $number > 1 ) echo '...';
5else $ // increase to have number start at 1.
6for( $number; $number < $number + $count; $number++)
7{
8 // your for loop as normal
9}
10if( $number < $total ) echo '...';