first page
page_no = 1
previous page
<?php if ($page_no >=2) {echo $page_no–1;}else{echo ‘1’;}?>
//current page
<?php echo $page_no; ?>
// the next page
<?php if ($page_no >=1 && $page_no <$total_pages) { echo $page_no+1; }
else { echo $page_no; } ?>
//last page
<?php echo $total_pages; ?>