Added logic on category pages to obtain number of pages