Improve discard logic for combined settings

When both number to keep and status is configured, the number is
evaluated after status is considered.