fixed posts title logic to not overshoot the maximum number of posts