Fix pending count for the reverse changes feed

Previously, pending changes count for the `descending=true` didn't indicate the
number of pending changes. Instead, it returned the negative value of the
already emitted rows. So for `descending=true&limit=2`, it would return -2; for
`descending=true&limit=5`, it would return -5. That wasn't a very useful value,
so let's fix it to return the actual number of pending changes.

When traversing the changes feed backwards, the number of pending changes until
the start will be equal the total number of changes minus the number of changes
from the current start sequence until the end.

Issue: https://github.com/apache/couchdb/issues/4714
2 files changed