Ciao a tutti...io ho questa paginazione fatta con la programmazione a oggetti:

Codice PHP:
<?php
//la classe per il paging
class Paging {
    private 
$totPag//Totale Pagine nella tabella
    
private $pagCorr//Pagina corrente
    
private $totRighe//Totale righe nella tabella
    
private $righePerPagina//Numero di righe per pagina da ottenere

    //Facilita l'accesso all'array dell'intervallo
    
const kIntervalloInizio='inizio';
    const 
kIntervalloLunghezza='lunghezza';

    
// Il costruttore chiede quale sia la pagina corrente, il totale delle
    // righe in tabella e quante righe per pagina interessano
    
public function __construct($pagCorr,$totRighe,$righePerPagina) {
        
$this->pagCorr=$pagCorr;
        
$this->totRighe=$totRighe;
        
$this->righePerPagina=$righePerPagina;
        
$this->totPag=$this->contaPagine($totRighe$righePerPagina);}

    
// Consente di modificare la pagina corrente con un'altra dopo
    // l'esecuzione del construct
    
public function vaiAPagina($pagina){
        if(
$pagina==self::kUltimaPagina)
            
$this->pagCorr=$this->totPag;
        elseif(
is_numeric($pagina) and $pagina>and $pagina<$this->totPag)
            
$this->pagCorr=$pagina;
        else
            
$this->pagCorr=1;
    }

    
//Indica in quante pagine viene divisa la tabella
    
public function contaPagine($totRighe$righePerPagina) {
        return 
ceil($totRighe $righePerPagina);
    }

    
//Restituisce un array indicante la posizione del primo record e quante
    //righe occorre scorrere
    
public function dammiIntervallo() {
        return array(
            
self::kIntervalloInizio => ($this->pagCorr-1) * $this->righePerPagina,
            
self::kIntervalloLunghezza => $this->righePerPagina
        
);
    }

    
//Ritorna il numero per la prossima pagina
    
public function prossimaPagina(){
        if(
$this->totPag==0)
                return 
1;
        return (
$this->pagCorr>=$this->totPag)?$this->totPag:$this->pagCorr+1;
    }

    
//Ritorna il numero per la pagina precedente
    
public function precedentePagina(){
        return (
$this->pagCorr<=1)?1:$this->pagCorr-1;
    }

}

//PREPARA L'OGGETTO PAGING E LO RITORNA
function CostruisciOggettoPaging($sql) {
    if (!isset(
$_GET['p']))
    
$pagCorr 1;
    else
    
$pagCorr=$_GET['p'];
    
$res mysql_query($sql) or die('Err3');
    
$totRighe mysql_num_rows($res);
    
mysql_free_result($res);
    
$righePerPagina 25;
    return new 
Paging($pagCorr$totRighe$righePerPagina);}

//costruiamo la tabella per posizionare le squadre
function CostruisciTabella($p,$sql) {
    
$inter=$p->dammiIntervallo();
    
$res mysql_query("$sql limit {$inter[Paging::kIntervalloInizio]},{$inter[Paging::kIntervalloLunghezza]}") or die('Err4');
    
ob_start();
    
//Definizione della tabella
    
echo <<<END
<table cellspacing="0" cellpadding="5" rules="all" width="540px" border="0" style="border-color:#CCCCFF;">
    <tr>
        <th width="150px">Squadra</th>
        <th width="150px">Manager</th>
        <th width="60px">Punti</th>
        <th width="60px">Vittorie</th>
        <th width="60px">Pareggi</th>
        <th width="60px">Sconfitte</th>
   </tr>
END;
    while (
$row mysql_fetch_assoc($res)) {
    
$costo number_format($row['costo'], "0""""."); 
    echo <<<END
    <tr>
        <th width="150px">[url="squadra.php?id=
{$row['team']}"]{$row['team']}[/url]</th>
        <th width="150px">[url="squadra.php?id=
{$row['team']}"]{$row['manager']}[/url]</th>
        <th width="60px">
{$row['punti']}</th>
        <th width="60px">
{$row['vittorie']}</th>
        <th width="60px">
{$row['pareggi']}</th>
        <th width="60px">
{$row['sconfitte']}</th>
    </tr>
END;
    }

//Link di navigazione
echo <<<END
<th colspan="2">
[url="
{$_SERVER['PHP_SELF']}?p={$p->precedentePagina()}"]Indietro[/url] |
[url="
{$_SERVER['PHP_SELF']}?p={$p->prossimaPagina()}"]Avanti[/url]
</th>
</table>
END;
mysql_free_result($res);
return 
ob_get_clean();}

//connessione al database
include('../connect.php');

//estrazione dei giocatori
$sql="SELECT * FROM SQUADRA_dati ORDER BY punti DESC";

$p CostruisciOggettoPaging($sql);
$tabella_dati CostruisciTabella($p,$sql);

mysql_close($conn);

echo 
$tabella_dati;
?>
Come potete vedere verrano stampati i link di navigazione "Indietro" "Avanti"...come posso modificare il mio script affinchè vengano mostrate il numero delle pagine 1,2,3 ecc.

Grazie per l'aiuto