vorrei evitare il mod_rewrite !!!
Io ho una classe che legge l'URL. Poi ho un'altra classe che fa la paginazione. Ma come ho scritto io mi vien fuori cosi' l'URL

www.miosito.com/1 <- se l'utente si trova alla pagina 1, mentre se clicca pagina 2 vien fuori cosi' : www.miosito.com/1/2 e non so come mai.

Certe volte vien fuori www.miosito.com//2 con il doppio // ma funziona lo stesso e va a pagina 2. Invece il problema consiste nel fatto che se l'utente clicca next (trovandosi alla pagina 2) vien fuori questo www.miosito.com/2/3 e se clicca ancora next vien fuori www.miosito.com/2/3/3 non so come mai. Volevo usare un header location ma non funziona. Se qualcuno ha un'idea é ben accetta



posto il codice:

include('uri.php');


class pagination {

var $fullresult;
var $totalresult;
var $query;
var $resultPerPage;
var $resultpage;
var $pages;
var $openPage;

function createPaging($query,$resultPerPage)
{

$uri = new uri;
$uri->fetch_uri_string();
$uri->explode_segments();
$page = $uri->segment(0);

$this->query = $query;
$this->resultPerPage= $resultPerPage;
$this->fullresult = mysql_query($this->query);
$this->totalresult = mysql_num_rows($this->fullresult);
$this->pages = $this->findPages($this->totalresult,$this->resultPerPage);
if(isset($page) && $page>0) {
$this->openPage = $page;
if($this->openPage > $this->pages) {
$this->openPage = 1;
}
$start = $this->openPage*$this->resultPerPage-$this->resultPerPage;
$end = $this->resultPerPage;
$this->query.= " LIMIT $start,$end";
}
elseif($page>$this->pages) {
$start = $this->pages;
$end = $this->resultPerPage;
$this->query.= " LIMIT $start,$end";
}
else {
$this->openPage = 1;
$this->query .= " LIMIT 0,$this->resultPerPage";
}
$this->resultpage = mysql_query($this->query);
}

function findPages($total,$perpage)
{
$pages = intval($total/$perpage);
if($total%$perpage > 0) $pages++;
return $pages;
}


function displayPaging()
{
$self = $_SERVER['PHP_SELF'];
if($this->openPage<=0) {
$next = 2;
}

else {
$next = $this->openPage+1;
}
$prev = $this->openPage-1;
$last = $this->pages;

if($this->openPage > 1) {
echo "<a href=$self/1>First</a>&nbsp";
echo "<a href=$self/$prev>Prev</a>&nbsp";
}
else {
echo "First&nbsp";
echo "Prev&nbsp";
}
for($i=1;$i<=$this->pages;$i++) {
if($i == $this->openPage)
echo "$i&nbsp";
else
echo "<a href=$self/$i>$i</a>&nbsp";
}
if($this->openPage < $this->pages) {
echo "<a href=$self/$next>Next</a>&nbsp";
echo "<a href=$self/$last>Last</a>&nbsp";
}
else {
echo "Next&nbsp";
echo "Last&nbsp";
}
}
}
?>