protected function paginate() { $search = NULL; if (isset($_GET['uid'])) { $search = $_GET['uid']; } if ($search != NULL) { global $objPDO; include $_SERVER['DOCUMENT_ROOT'] . '/cloud/model/student_profile_class.php'; $stu = new StudentProfile($objPDO); $count_roll = $stu->countRollMatch($search); $count_name = $stu->countNameMatch($search); $num_result = $count_roll > $count_name ? $count_roll : $count_name; $pages = ceil($num_result / 5); for ($i = 1; $i <= $pages; $i++) { echo '<div class="paginate_elem" id="' . $i . '">' . $i . '</div>|'; } } }