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.