Revert "Changed code that makes sorts sql command history to specify ascending (+1) instead"

This reverts commit 65de3037134ffce5afead8cf19b01d45f3b9707d.

Turns out that this changed behavior, because the limit happened before the reverse.