[frontend] made pagination template generic and reusable