added server-side paging and sorting for photos