You don't want to use any plugins? Then you either need to get a new job or stop asking rails-talk to do your homework...
Seriously though, mislav-will_paginate on github does exactly what you're looking for. Don't re-invent the wheel.
--Matt Jones