I wrote a class which displays 1 2 3 4 5 link pages. Is it what you want? Just email me at jf@virtuelle.ca
The class takes a mysql query, finds the number of results, than returns all what you need: current page, total number of pages, total number of pages to show, etc.
The class is not perfect, because there is some html code returned by some functions, but still I guess it will be a good starting point for you.