<div dir="ltr">I do not think, this is related to bidi, thefollowing minimal works for me with no problem: <br><br>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br>
<meta name="qrichtext" content="1"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style="margin: 0px; text-indent: 0px;">\documentclass{minimal}</p>

<p style="margin: 0px; text-indent: 0px;">\usepackage{lastpage}</p>
<p style="margin: 0px; text-indent: 0px;">\usepackage[RTLdocument]{bidi}</p>
<p style="margin: 0px; text-indent: 0px;">\begin{document}</p>
<p style="margin: 0px; text-indent: 0px;">\pageref{LastPage}</p>
<p style="margin: 0px; text-indent: 0px;">\end{document}</p>%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%<br clear="all"> <br>Therefore, I guess that would be polyglossia&#39;s problem.<br>-- <br>Best wishes,<br>Vafa Khalighi<br>
</div>