%links is populated even for just-deleted pages, so %pagesources should be used for such tests instead.