Greatly improve performance of folders_render

Simply use query.count_[messages,threads] instead of
actually running the query and using the count attribute
of the result set.