//filter number
    if (!is_numeric($pageNumber)) {
        die('Invalid page number!');
    }
    //incase of invalid page number
} else {
    $pageNumber = 1;
    //if there's no page number, set it to 1
}
$project_id = filter_input(INPUT_POST, 'project_id');
$projectMgr = new ProjectManager();
$photoMgr = new PhotoManager();
$photoPerPage = 9;
$results = [];
//get total number of records from database
$totalNumberImages = $photoMgr->getTotalNumberOfThumbnailPhotosOfProject($project_id);
//break records into pages
$totalPages = ceil($totalNumberImages / $photoPerPage);
//fetch position of record
$pagePosition = ($pageNumber - 1) * $photoPerPage;
//Fetch part of records using SQL LIMIT clause
$results = $photoMgr->getPaginatedResults($pagePosition, $photoPerPage, $project_id);
//Display fetched records
if (!empty($results)) {
    //$_SESSION['results'] = $filteredProjects;
    ?>
        <div id='thumbnails'>
<?php 
    if ($pageNumber == 1) {
        $count = 0;
    } else {