«إذا سها أحدكم في صلاته فلم يدر واحدة صلى أو اثنتين فليبن على واحدة فإن لم يدر ثلاثا صلى أو أربعا فليبن على ثلاث وليسجد سجدتين قبل أن يسلم»
The Prophet (peace and blessings be upon him) said:
"When one of you forgets in his prayer and does not remember whether he has prayed one rak'ah or two, let him build on one (that is, count it as only one); and if he does not remember whether he has prayed three or four, let him build on three, and let him perform two prostrations (of forgetfulness) before giving the salam."