cgi/html: Fix incomplete list of sub-groups in overview

The function for generating the group data is recursive,
however it reuses the same prepared statement. After the
first sub-group recursion, the original result of the
statement is gone.

Save the complete result set before we loop over it to
avoid this.
cgi/html: Fix PATH for fetched groups

PATH and PATHNAME for fetched groups is used to generate the
comparison URLs. Generate complete lists so we get correct
comparison URLs.

We should probably consider simplifying that section in the
overview template. Using the URL variable (as used for the
link to the group/domain view) should suffice.