HTML -Pagination PHP

	<?php
		$total_pages = ceil($recordsTotal / $length); 
		$pagBtn = "<ul class='pagination'>"; 
		$active_page = $start;
		$show_page_numbers = [];
		$minus_page = $active_page-2;
		$plus_page = $active_page+3;
		if ($minus_page < 1 || $active_page == 1) {
			$minus_page = 1;
		}
		if ($active_page > 3) {
			$pagBtn .= "<li class='page-item' data-page_no='1'>1</li>";
		}
		if (($minus_page - 1) > 1) {
			$pagBtn .= "... ";
		}
		$last_page = '';
		for ($i=$minus_page; $i < $plus_page; $i++) { 
			if ($i < $total_pages) {
				$show_page_numbers[] = $i;
				$pagBtn .= "<li class='page-item ";
				if ($active_page==$i){ 
					$pagBtn .= " active";
				}
				$pagBtn .= "' data-page_no=".$i.">".$i."</li>"; 
				$last_page = $i;
			}
		}
		if (($total_pages - $last_page) > 1) {
			$pagBtn .= "... ";
		}
		if ($total_pages > $last_page) {
			$pagBtn .= "<li class='page-item ";
				if ($active_page==$total_pages){ 
					$pagBtn .= " active";
				}
				$pagBtn .= "' data-page_no=".$total_pages.">".$total_pages."</li>"; 
		}
		echo $pagBtn . "</ul>"; 
	?>
Handsome Horse