I have huge results and paginated according to the results.
$total_records = 156;
$limit = 20;
$total = ceil($total_records/$limit);
<previous>
for($i=1;$i<$total;$i++){
$paging .= <li>$i</li>;
}
<next>
outputs
1 2 3 ... 32 pages.
How to control the pagiantion handling if the user select 5 per limit and show the pages
1 2 3 5 6 7 8 next 9 10 11 12 13 14 15 next 15 16 32 next