Added a fix to use pagination with array rather than active records