Started a PR at https://github.com/xwiki/xwiki-platform/pull/4622
The best of solution is up to interpretation, but this is better than uncontrolled overflowing