This happens because the Unicode bidi algorithm tries to re-arrange numbers and letters from different alphabets and cannot guess the user's intention correctly. This is especially common on MediaWiki sites with page titles, usernames, and IP addresses.
In this particular case, when editing in wiki syntax, the Arabic title is separated from the IP address numbers by "Special:Contributions" so it looks correct (to people who are accustomed to reading a lot of wiki syntax), but when the page is rendered in HTML, the numbers immediately follow the Arabic letters, so they jump to the wrong side of the page title.
Ideally, all page titles, usernames, and IP addresses should be bidi-isolated using the <bdi> tag or CSS such as unicode-bidi: isolate (more robust and semantic, but may have compatibility issues) or display: inline-block (more compatible, but less semantic and may have other issues). Since links, by their nature, usually point to titles and user names, this should be applied to links.
Until this bug is resolved comprehensively by applying it consistently everywhere, I can recommend applying the solutions above in templates that mention usernames or page titles, and to add <span dir="rtl">title</span> or <bdi>title</bdi> when mentioning RTL page titles in LTR wikis (and vice versa).