So, you have a task where you are supposed to display X items but only Y items per page and only link to Z pages at any one time? This can be a fairly complex task. I figured that I would offer my ~80 line solution to the problem.
Here’s an example of what the output should look like.
[gist id=4315198 file=pagination.cfm bump=1]