i want the numbers to be displayed in this format..
1 2 3 4 5
^
where if i press 5, then it should display from 5 to 10
5 6 7 8 9 10
til
We cannot give the specific/exact answer you expected. The thing here is we can give you some advice for some logic ways to accomplish your request.
First thing is, read some documents for creating a well designed structure of your pagination. Here are some links that may help you in building the design of your pagination.
For my personal experience in designing my pagination and a large data will retrieve from a database. I'll use a LIMIT in my sql query to fasten retrieving the results. And I'll do things as follows.
I know my explanation is not clear but I hope you get some point on it.
And now you could ask what's the relevant to your question. It is the process of how your presentation communication with your business layer. What I mean is the flow on how will you get the result you needed if some page number was call. Seems not really clear for that I'll make pseudo-codes that more related to you're question.
Since you don't have a ( First | Prev | page no here.... | Next | Last ) on your pagination. I'll make it short as possible.
First loading of the page with default pages. Assuming page data is from database and with the use of LIMIT
The logic here is, from your pagination display you will need to pass a value that your logic layer will understand what will be the next pages to be display. Another way is you can set a condition in you logic layer how to count the pages if it is not in the range of 1 - 4 or other thing you need to validate.
I hope this can be a help.