added pagination for topics and posts based on will_paginate