Refactored pagination logic into partial view