{$pagename|escape} を以下のもので書き換えます。

{$source|escape}

よろしいですか?