Ok so I named this file pagination.php and I include it everytime I paginate my data. IT works but the thing I worry about is the URL.

Take this:

<div id='thebox' style='clear:both;'>
<div class='boxtitle'>Pages</div>
<div class='boxwrap'>

echo "<ul class='pagination'>";
// range of num links to show
$range = 6;
// if not on page 1, don't show back links
if ($currentpage > 1) {
   // show << link to go back to page 1
   echo "<li class='next'><a href='&currentpage=1' title='Go to first page'>&laquo; First</a></li>";
   // get previous page num
   $prevpage = $currentpage - 1;
   // show < link to go back to 1 page
   echo "<li class='next'><a href='&currentpage=$prevpage' title='Go to previous page'>&laquo; Prev</a></li>";
    // show << link to go back to page 1
   echo "<li class='previous-off'>« First</li>";
   // get previous page num
   $prevpage = $currentpage - 1;
   // show < link to go back to 1 page
   echo "<li class='previous-off'>« Prev</li>";
} // end if 
// loop to show links to range of pages around current page
for ($x = (($currentpage - $range) - 1); $x < (($currentpage + $range) + 1); $x++) {
   // if it's a valid page number...
   if (($x > 0) && ($x <= $totalpages)) {
      // if we're on current page...
      if ($x == $currentpage) {
         // 'highlight' it but don't make a link
         echo "<li class='active'>$x</li>";
      // if not current page...
      } else {
         // make it a link
	 echo "<li><a href='&currentpage=$x'>$x</a></li>";
      } // end else
   } // end if 
} // end for
// if not on last page, show forward and last page links	
if ($currentpage != $totalpages) {
   // get next page

   $nextpage = $currentpage + 1;
    // echo forward link for next page 
   echo "<li class='next'><a href='&currentpage=$nextpage' title='Go to the next page'>Next &raquo;</a></li>";
   // echo forward link for lastpage
   echo "<li class='next'><a href='&currentpage=$totalpages' title='Go to last page'>Last &raquo;</a></li>";
     echo "<li class='previous-off'>Next &raquo;</li>";
   // echo forward link for lastpage
   echo "<li class='previous-off'>Last &raquo;</li>";  

echo "</ul> ";

<div style='clear:both;'></div>
Now let's say I stick it in leaderboards.php... I Then I go to my case of leaderboards.php?act=monthly... well in the links below... my url goes to... http://site.com/leaderboards.php?currentpage=2 which will give me a 404 error.... So I how do I make it so the links point to do cases as well such as http://site.com/leaderboards.php?act...&currentpage=2