Added pagination and sorting for index pages