Reset pageResultSize when PaginationType NONE back-fill results

This is a follow up of change 413358.

In particular, if some results are skipped because of
of the visibility constraints, more changes need to
be asked from the index, and pageResultSize needs to
be reset to know how many results are returned from each

Without this change querying for more changes could end
up in an infinite loop as exposed in a test in 3.6 [1]


Release-Notes: skip
Change-Id: I566010c6f5bfcb4fbc003bc6693aa25d4dd44a81
diff --git a/java/com/google/gerrit/index/query/ b/java/com/google/gerrit/index/query/
index d89fe66..8390cbb 100644
--- a/java/com/google/gerrit/index/query/
+++ b/java/com/google/gerrit/index/query/
@@ -100,6 +100,7 @@
               int nextStart = pageResultSize;
               while (pageResultSize == limit && r.size() < limit) {
                 ResultSet<T> next = p.restart(nextStart);
+                pageResultSize = 0;
                 for (T data : buffer(next)) {
                   if (match(data)) {