Notice: Undefined variable: prev_link in
<p>I have some errors:</p>

<pre><code>Deprecated: Function eregi_replace() is deprecated in C:\xampp\htdocs\manager\Pagination.php on line 86
Notice: Undefined variable: prev_link in C:\xampp\htdocs\manager\Pagination.php on line 81
Notice: Undefined variable: query_string in C:\xampp\htdocs\manager\Pagination.php on line 66
</code></pre>

<p><strong>Here is the code</strong></p>

<pre><code>&lt;?php

class Pagination {
    function getStartRow($page,$limit){
        $startrow = $page * $limit - ($limit);
        return $startrow;
    }   
    function showPageNumbers($totalrows,$page,$limit){

        $query_string = $this-&gt;queryString();

        $pagination_links = null;

        /*
        PAGINATION SCRIPT
        seperates the list into pages
        */      
         $numofpages = $totalrows / $limit; 
        /* We divide our total amount of rows (for example 102) by the limit (25). This 

    will yield 4.08, which we can round down to 4. In the next few lines, we'll 
    create 4 pages, and then check to see if we have extra rows remaining for a 5th 
    page. */

        for($i = 1; $i &lt;= $numofpages; $i++){
        /* This for loop will add 1 to $i at the end of each pass until $i is greater 
    than $numofpages (4.08). */     

          if($i == $page){
                $pagination_links .= '&lt;div class="page-link"&gt;&lt;span&gt;'.$i.'&lt;/span&gt;&lt;/div&gt; ';
            }else{ 
                $pagination_links .= '&lt;div class="page-link"&gt;&lt;a href="?page='.$i.'&amp;'.$query_string.'"&gt;'.$i.'&lt;/a&gt;&lt;/div&gt; '; 
            }
            /* This if statement will not make the current page number available in 
    link form. It will, however, make all other pages available in link form. */
        }   // This ends the for loop

        if(($totalrows % $limit) != 0){
        /* The above statement is the key to knowing if there are remainders, and it's 
        all because of the %. In PHP, C++, and other languages, the % is known as a 
        Modulus. It returns the remainder after dividing two numbers. If there is no 
        remainder, it returns zero. In our example, it will return 0.8 */

            if($i == $page){
                $pagination_links .= '&lt;div class="page-link"&gt;&lt;span&gt;'.$i.'&lt;/span&gt;&lt;/div&gt; ';
            }else{
                $pagination_links .= '&lt;div class="page-link"&gt;&lt;a href="?page='.$i.'&amp;'.$query_string.'"&gt;'.$i.'&lt;/a&gt;&lt;/div&gt; ';
            }
            /* This is the exact statement that turns pages into link form that is used above */ 
        }   // Ends the if statement 

        return $pagination_links;
    }

    //added by drale.com - 1-19-2010
    function showNext($totalrows,$page,$limit,$text="next &amp;raquo;"){    
        $next_link = null;
        $numofpages = $totalrows / $limit;

        if($page &lt; $numofpages){
            $page++;
            $next_link = '&lt;div class="page-link"&gt;&lt;a href="?page='.$page.'&amp;'.$query_string.'"&gt;'.$text.'&lt;/a&gt;&lt;/div&gt;';
        }

        return $next_link;
    }

    function showPrev($totalrows,$page,$limit,$text="&amp;laquo; prev"){    
        $next_link = null;
        $numofpages = $totalrows / $limit;

        if($page &gt; 1){
            $page--;
            $prev_link = '&lt;div class="page-link"&gt;&lt;a href="?page='.$page.'&amp;'.$query_string.'"&gt;'.$text.'&lt;/a&gt;&lt;/div&gt;';
        }

        return $prev_link;
    }

    function queryString(){ 
        //matches up to 10 digits in page number
        $query_string = eregi_replace("page=[0-9]{0,10}&amp;","",$_SERVER['QUERY_STRING']);
        return $query_string;
    }
} 
?&gt;
</code></pre>
