Fix EZP-22519: Number of history items regression

After fixing EZP-22519 the number of maximum items was not respected. It was missing one item because we are doing the check after the creation instead of before.
Merge pull request #925 from ezsystems/ezp-22519-history_max_version_regression

Fix EZP-22519: Number of history items regression