Pagination Proving Problematic

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Firstly, I apologise for the subject.

Secondly, I am having problems with my paging code for a website I am
developing. The code works, but not how I would like it and I cannot
fix the problems with it to get it how I would like it. So I am
reaching out in to the community to try and get some assistance for
people more versed in PHP than I am.

Basically, the code works as found on

I didn't know where to start so I found a tutorial on PHPFreaks
( )

The problems I am having stem from the formatting of the code.
Currently, the active page is the one that comes right after 'Prev'. I
would like this to appear in the middle as the disagram below (without
the brackets):

< Prev 1 2 3 (4) 5 6 7 Next >

Also, as you scroll to the end of the list, the pages listed get
smaller and smaller until there is only 1 left being displayed.

If there is anyone who can help me I would be most grateful. The php
for the page can be found here:

Thank you.

Site Timeline