Sunan An-Nasa'i - سنن النسائي
13. The Book of Forgetfulness (In Prayer) - كتاب السهو
25) Chapter: Estimating (what is most likely the case)
It was narrated that 'Abdullah said:
"The Messenger of Allah (ﷺ) said: 'If one of you is not sure about his prayer, let him estimate and prostrate twice after he has finished."
25) باب التَّحَرِّي
أَخْبَرَنَا مُحَمَّدُ بْنُ عَبْدِ اللَّهِ بْنِ الْمُبَارَكِ الْمُخَرَّمِيُّ، قَالَ حَدَّثَنَا وَكِيعٌ، عَنْ مِسْعَرٍ، عَنْ مَنْصُورٍ، عَنْ إِبْرَاهِيمَ، عَنْ عَلْقَمَةَ، عَنْ عَبْدِ اللَّهِ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم . " إِذَا شَكَّ أَحَدُكُمْ فِي صَلاَتِهِ فَلْيَتَحَرَّ وَيَسْجُدْ سَجْدَتَيْنِ بَعْدَ مَا يَفْرُغُ "