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
query.

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

[1]: https://gerrit.googlesource.com/gerrit/+/refs/heads/stable-3.6/javatests/com/google/gerrit/server/query/change/FakeQueryChangesTest.java#126

Release-Notes: skip
Change-Id: I566010c6f5bfcb4fbc003bc6693aa25d4dd44a81
diff --git a/java/com/google/gerrit/index/query/PaginatingSource.java b/java/com/google/gerrit/index/query/PaginatingSource.java
index d89fe66..8390cbb 100644
--- a/java/com/google/gerrit/index/query/PaginatingSource.java
+++ b/java/com/google/gerrit/index/query/PaginatingSource.java
@@ -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)) {
                     r.add(data);