CakePHP 1.2 Pagination explained

Today I spent a lot of time trying to figure out how to have CakePHP 1.2 pagination with all the flexibility. Because all I wanted to do was to filter the records of my model AND also unbind ALL associated models. I found the information in tits and bits a bit scattered around. So I've decided to make one spot for it, at least for my own future reference. Here is what I've understood:
There are 2 parts you have to take care of, one for the component and the other for the helper. Here is a generic example for the Post model,

/** function index () in your Posts controller **/
$this->paginate['Post'] = array(
'limit'=> 20,
'order'=> "Model.field ASC", // for example i.e.
'fields'=> array(
'Post.id',
'Post.name', //.....
),
'url'=> array(
'controller'=> 'Posts', // could be $this->name
'action'=> 'index', // could be $this->action
'created'=> '02-02-2008',
'active'=> 1, // ... modelField/Value pairs you'd like to set as filters
)
);
$posts = $this->paginate(
'Post',
array(
"Post.created = '02-02-2008' AND Post.active = 1"
)
);
$this->set('posts', $posts);
$this->set('paginationUrl', array('url'=>$this->paginate['Post']['url']));

This will let the component do the math and calculate how many rows are being returned. Since pagination component executes a simple "findAll()", so it will treat all modelField / Value pairs it finds in the URL key as search criteria i.e. conditions just like you'd specify conditions as array in any "findAll()" call.
To keep or switch between the modelField / Value pairs throughout the pages, you can pass these as URL parameters. So your URL should look kind of like this:
http://yourhost/cake_root/controller/action/page:2/modelField:value/mode... ....
Now for the pagination helper, we'd use $paginationUrl array that we set for our view:

/** after rendering all posts **/
pr($posts); /* or you can use Cake's built in function to display the $posts array */
echo $paginator->prev("<< Prev", array("url"=>$paginationUrl));
echo $paginator->numbers(array("url"=>$paginationUrl));
echo $paginator->next("Next >>", array('url'=>$paginationUrl));

And that's it, now the paginator links would render your given modelField / Value pair. But there is or "was" a downside about it that my db fields would be seen via the URL. For example, the URL for the above action would be like this:
root/controller/action/page:2/created:02-02-2008/active:1
and that was unacceptable for me, so I created a masking scheme for my field / value pairs. May be I'd make a component out of it, but that won't be as generic as you'd still have to pass the Masks / Fields pairs as an array.
Ahh !! so what about unbinding associated models ? ... well ... what I do is that I use the cool unbindAll function by Othman Ouihibi. I've been using it since CakePHP 1.1 days. But there's a behavior that supports this functionality too on the Bakery, pretty cool. So I just unbindAll models except the ones I need before every paginate call in my controller and that does the trick. Any suggestions / comments would be highly appreciated.
This article was originally made by collecting information from the comments here, so I'd strongly advise anyone who wants to know advance paging to read that article.
HAPPY BAKING !!!