Hi Somesh,
Not an answer to your question, but from point of view of UX, having thousands of pages to choose from and only having 4 pages + the very last directly adressable is not very usefull.
So you can make it look slightly better, but is still a unsatisfying interaction.
Dorine