shorten if necessary
(from redmine: issue id 1101, created on 2018-07-20tgradl, closed on 2018-07-21)