def query_pager_by_slug(slug, current_page_num=1, tag='', order=False):
        '''
        Query pager via category slug.
        '''
        cat_rec = MCategory.get_by_slug(slug)
        if cat_rec:
            cat_id = cat_rec.uid
        else:
            return None

        # The flowing code is valid.
        if cat_id.endswith('00'):
            # The first level category, using the code bellow.
            cat_con = TabPost2Tag.par_id == cat_id
        else:
            cat_con = TabPost2Tag.tag_id == cat_id

        if tag:
            condition = {
                'def_tag_arr': [tag]
            }
            recs = TabPost.select().join(
                TabPost2Tag,
                on=((TabPost.uid == TabPost2Tag.post_id) & (TabPost.valid == 1))
            ).where(
                cat_con & TabPost.extinfo.contains(condition)
            ).order_by(
                TabPost.time_update.desc()
            ).paginate(current_page_num, CMS_CFG['list_num'])
        elif order:
            recs = TabPost.select().join(
                TabPost2Tag,
                on=((TabPost.uid == TabPost2Tag.post_id) & (TabPost.valid == 1))
            ).where(
                cat_con
            ).order_by(
                TabPost.order.asc()
            )
        else:
            recs = TabPost.select().join(
                TabPost2Tag,
                on=((TabPost.uid == TabPost2Tag.post_id) & (TabPost.valid == 1))
            ).where(
                cat_con
            ).order_by(
                TabPost.time_update.desc()
            ).paginate(current_page_num, CMS_CFG['list_num'])

        return recs
Query pager via category slug.