hey guys

i need help in php pagination in some kind of CMS

it's original pagination code is


PHP Code:
<?php



$pages 
.="pages : ";



for(
$i=0;$i<$num_pages;$i++)

{

    
$s $i+1;

    if(
$s==$current) {

    
$pages .= "<FONT face=tahoma size=2><B>$s</B></FONT>&nbsp; &nbsp;";

    }else {

$pages .= "&nbsp;<A href='start-".$i*$limit1."'>[$s] </A>&nbsp;";

}

}

$p $_GET['start']+$limit1;

$pages .= "<A href='start-$p'>&nbsp;&gt;</A>";


?>
and i have modified it to


PHP Code:
<?php



for($limit1=0;$limit1<$num_pages;$limit1++)

{

    
$s $limit1+2;

    if(
$s==$current) {

$p $_GET['start']-$pagesnum;

$pages .= "<td ><A href='p$p'><div onMouseOver='turn_off(this);' onmouseout='turn_on(this);' class='page'>prev</div></A></td>";  

    } 

    }



for(
$i=0;$i<$num_pages;$i++)



    
$s $i+1;

    if(
$s==$current) {

    
$pages .= "<td ><div onMouseOver='turn_off(this);' onmouseout='turn_on(this);' class='cpage'>$s</div></td>";

    }else {

$pages .= "<td ><A href='p".$i*$pagesnum."'><div onMouseOver='turn_off(this);' onmouseout='turn_on(this);' class='page'>$s </div></A></td>";

}



}



for(
$limit1=0;$limit1<$num_pages;$limit1++)

{

    
$s $limit1+1;

    if(
$limit1==$current) {

     
$p $_GET['start']+$pagesnum;

$pages .= "<td ><A href='p$p'><div onMouseOver='turn_off(this);' onmouseout='turn_on(this);' class='page'>next</div></A></td>";  

    } 

    }         

?>
but when the pages becomes more than 10

look



i need it when the pages becomes more then 10 to be like this



and there's an arabic site have the same CMS and pagination

http://www.arablionz.com/

i hope you help me