This is a fix for an old issue that Foxpup diagnosed:
The cause is that Arabic text automatically switches the text direction to right-to-left, and since the immediately following text is just numbers and punctuation marks, which can written in either direction, there's nothing to change it back.
Mods can fix it in this instance by adding a left-to-right mark (U+200E, ) to the end of the thread title, though that doesn't address the underlying bug.
Basically, topic titles ending with certain characters will cause the page numbers to mis-render, like this:
It's easy to find many examples of this on the Arabic and Hebrew local boards, like the following:
With this patch, the two previous examples would render like so:
Here's the diff for @theymos:
--- baseline/Sources/MessageIndex.php
2011-12-22 22:56:39.000000000 +0000
+++ modified/Sources/MessageIndex.php
2023-10-02 14:44:40.000000000 +0000
@@ -495,32 +495,32 @@
// Decide how many pages the topic should have.
$topic_length = $row['numReplies'] + 1;
if ($topic_length > $modSettings['defaultMaxMessages'])
{
$tmppages = array();
$tmpa = 1;
for ($tmpb = 0; $tmpb < $topic_length; $tmpb += $modSettings['defaultMaxMessages'])
{
$tmppages[] = '
' . $tmpa . '';
$tmpa++;
}
// Show links to all the pages?
if (count($tmppages) <= 5)
-
$pages = '« ' . implode(' ', $tmppages);
+
$pages = '« ' . implode(' ', $tmppages);
// Or skip a few?
else
-
$pages = '« ' . $tmppages[0] . ' ' . $tmppages[1] . ' ... ' . $tmppages[count($tmppages) - 2] . ' ' . $tmppages[count($tmppages) - 1];
+
$pages = '« ' . $tmppages[0] . ' ' . $tmppages[1] . ' ... ' . $tmppages[count($tmppages) - 2] . ' ' . $tmppages[count($tmppages) - 1];
if (!empty($modSettings['enableAllMessages']) && $topic_length < $modSettings['enableAllMessages'])
$pages .= '
' . $txt[190] . '';
$pages .= ' »';
}
else
$pages = '';
// We need to check the topic icons exist...
if (empty($modSettings['messageIconChecks_disable']))
{
if (!isset($context['icon_sources'][$row['firstIcon']]))
$context['icon_sources'][$row['firstIcon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['firstIcon'] . '.gif') ? 'images_url' : 'default_images_url';
if (!isset($context['icon_sources'][$row['lastIcon']]))
Edit: Adding a second diff because I noticed that this issue also shows up on
?action=unread,
?action=unreadreplies and
?action=watchlist.
--- baseline/Sources/Recent.php
2011-02-07 16:45:09.000000000 +0000
+++ modified/Sources/Recent.php
2023-10-06 04:52:26.000000000 +0000
@@ -981,32 +981,32 @@
// Decide how many pages the topic should have.
$topic_length = $row['numReplies'] + 1;
if ($topic_length > $modSettings['defaultMaxMessages'])
{
$tmppages = array();
$tmpa = 1;
for ($tmpb = 0; $tmpb < $topic_length; $tmpb += $modSettings['defaultMaxMessages'])
{
$tmppages[] = '
' . $tmpa . '';
$tmpa++;
}
// Show links to all the pages?
if (count($tmppages) <= 5)
-
$pages = '« ' . implode(' ', $tmppages);
+
$pages = '« ' . implode(' ', $tmppages);
// Or skip a few?
else
-
$pages = '« ' . $tmppages[0] . ' ' . $tmppages[1] . ' ... ' . $tmppages[count($tmppages) - 2] . ' ' . $tmppages[count($tmppages) - 1];
+
$pages = '« ' . $tmppages[0] . ' ' . $tmppages[1] . ' ... ' . $tmppages[count($tmppages) - 2] . ' ' . $tmppages[count($tmppages) - 1];
if (!empty($modSettings['enableAllMessages']) && $topic_length < $modSettings['enableAllMessages'])
$pages .= '
' . $txt[190] . '';
$pages .= ' »';
}
else
$pages = '';
// We need to check the topic icons exist... you can never be too sure!
if (empty($modSettings['messageIconChecks_disable']))
{
// First icon first... as you'd expect.
if (!isset($context['icon_sources'][$row['firstIcon']]))
$context['icon_sources'][$row['firstIcon']] = file_exists($settings['theme_dir'] . '/images/post/' . $row['firstIcon'] . '.gif') ? 'images_url' : 'default_images_url';