I've been trying to figure out an algorithm to create pages, dynamically.

Like, take my website for example (BinaryIdiot.com). I get all of my news from a database. I'd like to show, let's say 15 postings at a time, per page.

At the bottom I have a link that goes to next page but that only counts back, like 15 (can't remember if it's 15 or 14) and uses that as a start ID.

For some reason I can't wrap my head around doing actual page numbers. How do I do this?