impletemented the pagination using the array method.