Paginating an existing array

I have a rather complex query that constructs the array @posts I’d
really like to have these results paginated, but the nature of the query
I’m running won’t let me use pagination the normal way.

Since I already have a complete array, can’t I just paginate those
results some way?

I have this same doubt ._.
How do you fix it?