XF 1.5 Conditionals posts per page

I am currrenly using the following code to display an ad after the 3rd post if there are over 5 replies to the post.

How would I modify this to a per page post count instead of the entire thread?

I only want the ad to show if there are more than 5 posts per page, and not in the total thread.

<xen:if is="{$post.position} % {$xenOptions.messagesPerPage} == 2 AND {$thread.reply_count} > 5">
Last edited: