Wondering why nobody replied? That's because you'll get a headache making these unreadable conditionalsHas anyone turned the "After First, Middle and Before Last Post" option into "After First, Middle and After Last Post" and would care to share? I just played with it for a bit and couldn't get it to display.
Give this one a try:
<xf:if is="in_array($post.position % $xf.options.messagesPerPage, [0,($xf.options.messagesPerPage / 2) - 1]) OR $post.position % $xf.options.messagesPerPage + 1 == count($__globals.posts) AND count($__globals.posts)>4">