Ciao a tutti, non riesco a fare in modo nella seguente paginazione che la pagina attiva non sia linkata

codice:
<?php 

$DBhost = "localhost"; 
$DBuser = "root"; 
$DBpass = ""; 
$DBName = "mytest"; 

/* specifichiamo il nome della nostra tabella */ 
$table02 = "scheda"; 


/* Connettiamoci al database */ 
mysql_connect($DBhost,$DBuser,$DBpass) or die("Impossibile collegarsi al server"); 
@mysql_select_db("$DBName") or die("Impossibile connettersi al database $DBName");  


//# of posts to display per page 
$display = 5;  
  
//adds your page (if any) between like so '?{$uri}page=#' 
$uri = "p=blog&"; 
  
//Get current page 
$page = (!empty($_GET['page'])) ? $_GET['page'] : '0';  
  
//Find post to start on, depending on page 
$start = ($page == 0) ? $start = 0 : $start = (($page-1)*$display); 
  
//Print content & count number printed 
$query = "SELECT * FROM $table02 LIMIT {$start},{$display}"; 
$result = mysql_query($query) or die(mysql_error()); 
$displayed = 0; 
while($row = mysql_fetch_array($result)) { 
    $id = $row['id']; 
    $displayed++; 
}  
?> 

  
<div><?php echo "$id\n"; ?></div> 


<?php 

//Get number of total posts 
$count = mysql_query("SELECT id FROM $table02"); 
$rows = mysql_num_rows($count); 
  
//Get number of total pages 
$pages = ceil($rows/$display); 
  
//Make next/prev links 
$next = $page+1; 
$prev = $page-1; 
  
//Unlink if next/prev doesn't exsist 
$prevpage = ($prev == 0 || $prev == -1) ?  
"&lt;&lt; Prev" : "&lt;&lt; Prev"; 
$nextpage = ($next < $pages+1) ?  
"Next &gt;&gt;" : "Next &gt;&gt;"; 
  
//Get showing from-to numbers 
$from = $start; 
$from = ($from == 0) ? 1 : $from+1; 
$to = $start+$displayed; 
  
//Print individual page number links 
echo "{$prevpage}  ["; 
$i = 1; 
while($i != $pages+1) { 
    //Print pages & add coma to all but last page      
    echo "{$i}"; 
    if($i != $pages) {echo ", ";} 
    $i = $i+1; 
} 
echo "]  {$nextpage}"; 
?>
cioé se sono nella pagina 2 ad esempio dovrebbe uscire cosi: << Prev 1 , 2, 3 Next >>

invece anche la pagina 2 rimane linkata 2