Section: What to Do if One Forgets in Prayer
Yahya related to me from Malik from Ibn Shihab from Abu Salama ibn Abdar-Rahman ibn Awf from Abu Hurayra that the Messenger of Allah, may Allah bless him and grant him peace, said, “When you stand in prayer, Shaytan comes to you and confuses you until you do not know how much you have prayed. If you find that happening do two sajdas from the sitting position.”
Yahya related to me from Malik that he had heard that the Messenger of Allah, may Allah bless him and grant him peace, said, “I forget or I am made to forget so that I may establish the sunna.”
Yahya related to me from Malik that he had heard that a man questioned al-Qasim ibn Muhammad saying, “My imagination works in the prayer, and it happens to me a lot.” Al-Qasim ibn Muhammad said, “Go on with your prayer, for it will not goaway from you until you goaway saying, ‘I have not completed my prayer.’ “

Could the Shaykh who produced all the ahaadith (Shaykh Muhammad Afifi al-Akiti) please also quote the isnad, name of the book or books numbered/quoted from. Who or which ‘Yahya’ is meant at the beginning of every hadith quoted.
Please provide the above information promptly. Jazakullahu khair.
May Peace be Upon You,
We hope you’re in the greatest of health and states during this Blessed Month of Ramadhan.
With regards to your inquiry about the works shown; the works/haadith stated above are Translations of Imam Mālik ibn Anas ibn Malik ibn ‘Āmr al-Asbahi greatest work and compilation named and/or referenced as “Al-Muwatta” or “Muwatta” which when translated means “The Approved”. These works have been published as part of BaAlawi.com’s Hadith Database.
The Muwatta consists of approximately 1720 hadiths divided as follows[ referenced from "The Hadith for Beginners", Dr. Muhammad Zubayr Siddiqi, 1961 (2006 reprint), Goodword Books ]:
600 marfu hadiths
613 mauquf hadiths
285 maqtu hadiths
222 mursal hadiths
With regards to the individual named and/or referenced within the ahadith stated, “Yahya”, Imam Malik was referencing Yahya ibn Yahya al-Masmoodi al-Laythi (234 AH). This is the most famous transmission from Imam Maalik, and most of the scholars based their commentaries on it.
Al-Shaykh Muhammad Afifi Al-Akiti did not translate nor contribute to the Translated Hadiths above, nor was he involved in the creation/compilation/authoring of the Muwatta by Imam Malik.
A copy of the Translated Work of Al-Imam Malik, “Al-Muwatta” can be retrieved from a number of Publisher and Islamic Press/Publishers. The most notable of the Translations to English of the Muwatta are from A’isha `Abdarahman at-Tarjumana and Ya`qub Johnson.
We thank you for your inquiry and we urge one and all to contribute in discussions.
We will be providing a brief introduction to Imam Malik’s Al-Muwatta, inclusive of notable transmissions for Imam Malik, such that one will not be too lost whilst reading the ahaadith listed.
Warmest of Salams,
On behalf of BaAlawi.com
Administrators.