It depends on the database your are using.
If you were using MySQL it has functions to do that.
There is a generic form passing the current index to the next page, for example 26, then in that page move the resultset until the 26 row and display the next 25 rows.
The link for the back and next pages would have the indexes 1 and 51.
These form of getting data is not very good because your getting the full recordset every time. You could improve the performace writing to sotered procedures in order to get the data grather o lesser that the index received. And limiting the resultset size, your dbms must have an order to do so.