You should try to do the pagination via database, instead of loading all the results eagerly. If you had 100000 records and wanted to show only first 6 of them, you'd need to fetch 99994 records you might not use. Try to use limit
of sql.
As for your problem with "bolding" current page number, you have logic error here:
$i = 0;
for ($counter = 1; $counter <= $max_pages; $counter++) {
if($i == $start){
echo " <a href='index.php?os=$os=Search+source+code&start=$i'><b> $counter |</b></a> ";
} else {
echo " <a href='index.php?os=$os=Search+source+code&start=$i'> $counter |</a> ";
}
$i = $i + $per_page;
According to this snippet you are comparing $i to $start, where $i is always equal to 0, so it will bold anything only on first page.