Optimise summary view queries:

* Use #limit instead of #take to limit at server-side
* Convert to arrays in controller to avoid view issuing count queries
* Group by path_hash rather than path in aggregate query