Good day all programmers in the house. please I need help in the following area. The code posted below works perfectly for search and paginating my result as I used the same code for other pagination like product listing which doesn't involve any search but the challenge I have now is that after displaying the result on the search page (The page is self processing page), clicking the link to page 2 or 3 or other pages comes up with a blank page. I thought its because I used $_GET instead of $_POST but using $_POST doesn't solve the problem. Please what do I do to get the pagination links to work.
PHP Code:
//This does the actual searching
if (isset($_GET['action']) and $_GET['action'] == 'search')
{

//connect to the database
    
if(include_once ('DatabaseManager.php')); 
    
$conn DatabaseManager::getConnection();
    
//get the function
    
include_once ('function.php');

        
$page = (int) (!isset($_GET["page"]) ? $_GET["page"]);
        
$limit 1;
        
$startpoint = ($page $limit) - $limit;
       

if (
$_GET['product'] != '')
{
   
$product trim($_GET['product']);
}

if (
$_GET['purchaseDateFrom'] != '')
{
   
$purchaseDateFrom trim($_GET['purchaseDateFrom']);
}

if (
$_GET['purchaseDateTo'] != '')
{
   
$purchaseDateTo trim($_GET['purchaseDateTo']);
}

if (
$_GET['manufacturer'] != '')
{
   
$manufacturer trim($_GET['manufacturer']);
}

           
$statement "assets WHERE ";

if(isset(
$product)){    
                   
$statement .= "product LIKE '%" $product .  "%' AND ";
                }

if(isset(
$manufacturer)){    
                   
$statement .= "manufacturer LIKE '%" $manufacturer .  "%' AND ";
                }
if(isset(
$purchaseDateFrom) && isset($purchaseDateTo)){    
                   
$statement .= "(purchaseDate >=  '$purchaseDateFrom' AND purchaseDate <= '$purchaseDateTo') AND ";
                }
$statement .= '1';

 
$query $conn->query("SELECT * FROM {$statement} ORDER BY id DESC LIMIT {$startpoint} , {$limit}"); 
 
$assetRegister $conn->query("SELECT * FROM {$statement}"); 
 
$asset $assetRegister->rowCount(); 


The included function is below
PHP Code:
function pagination($query$per_page 10,$page 1$url '?'){ 
   include_once (
'DatabaseManager.php'); 
   
$conn DatabaseManager::getConnection();
           
        
$query "SELECT COUNT(*) as `num` FROM {$query}";
        foreach(
$conn->query($query) as $row);
        
$total $row['num'];
        
$adjacents "2"

        
$page = ($page == $page);  
        
$start = ($page 1) * $per_page;                                
        
        
$prev $page 1;                            
        
$next $page 1;
        
$lastpage ceil($total/$per_page);
        
$lpm1 $lastpage 1;
        
        
$pagination "";
        if(
$lastpage 1)
        {    
            
$pagination .= "<ul class='pagination'>";
                    
$pagination .= "<li class='details'>Page $page of $lastpage</li>";
            if (
$lastpage + ($adjacents 2))
            {    
                for (
$counter 1$counter <= $lastpage$counter++)
                {
                    if (
$counter == $page)
                        
$pagination.= "<li><a class='current'>$counter</a></li>";
                    else
                        
$pagination.= "<li><a href='{$url}page=$counter'>$counter</a></li>";                    
                }
            }
            elseif(
$lastpage + ($adjacents 2))
            {
                if(
$page + ($adjacents 2))        
                {
                    for (
$counter 1$counter + ($adjacents 2); $counter++)
                    {
                        if (
$counter == $page)
                            
$pagination.= "<li><a class='current'>$counter</a></li>";
                        else
                            
$pagination.= "<li><a href='{$url}page=$counter'>$counter</a></li>";                    
                    }
                    
$pagination.= "<li class='dot'>...</li>";
                    
$pagination.= "<li><a href='{$url}page=$lpm1'>$lpm1</a></li>";
                    
$pagination.= "<li><a href='{$url}page=$lastpage'>$lastpage</a></li>";        
                }
                elseif(
$lastpage - ($adjacents 2) > $page && $page > ($adjacents 2))
                {
                    
$pagination.= "<li><a href='{$url}page=1'>1</a></li>";
                    
$pagination.= "<li><a href='{$url}page=2'>2</a></li>";
                    
$pagination.= "<li class='dot'>...</li>";
                    for (
$counter $page $adjacents$counter <= $page $adjacents$counter++)
                    {
                        if (
$counter == $page)
                            
$pagination.= "<li><a class='current'>$counter</a></li>";
                        else
                            
$pagination.= "<li><a href='{$url}page=$counter'>$counter</a></li>";                    
                    }
                    
$pagination.= "<li class='dot'>..</li>";
                    
$pagination.= "<li><a href='{$url}page=$lpm1'>$lpm1</a></li>";
                    
$pagination.= "<li><a href='{$url}page=$lastpage'>$lastpage</a></li>";        
                }
                else
                {
                    
$pagination.= "<li><a href='{$url}page=1'>1</a></li>";
                    
$pagination.= "<li><a href='{$url}page=2'>2</a></li>";
                    
$pagination.= "<li class='dot'>..</li>";
                    for (
$counter $lastpage - (+ ($adjacents 2)); $counter <= $lastpage$counter++)
                    {
                        if (
$counter == $page)
                            
$pagination.= "<li><a class='current'>$counter</a></li>";
                        else
                            
$pagination.= "<li><a href='{$url}page=$counter'>$counter</a></li>";                    
                    }
                }
            }
            
            if (
$page $counter 1){ 
                
$pagination.= "<li><a href='{$url}page=$next'>Next</a></li>";
                
$pagination.= "<li><a href='{$url}page=$lastpage'>Last</a></li>";
            }else{
                
$pagination.= "<li><a class='current'>Next</a></li>";
                
$pagination.= "<li><a class='current'>Last</a></li>";
            }
            
$pagination.= "</ul>\n";        
        }
    
    
        return 
$pagination;
    }