Pagination added to index

get function also added to display latest posts from an element.