If you properly cook food (let's say in the oven for 2 hours) will there be no risk left? no pathogen will survive this?
Oven does not sterilize!
High temperatures like the one you get in a normal oven (250 degrees Celsius) can kill a great deal of microorganisms but not all of them. Also, consider that spores (including bacterial spores) can survive to extreme temperatures.
Lab-grade sterilization is obtained by high temperature, at high pressure and high humidity conditions. Have a look at this web page to get a glimpse. So, even though you can reach high temperatures in a modern oven, you miss the high pressure and uniform humidity needed for a proper sterilization.
Also, as already mentioned by @John, it depends on what you mean for safe. 1) your food can be contaminated with toxic molecules and they may not be degraded by temperature alone, so even if you get a microbiologically clean food, that doesn't make it necessarily safe. 2) Many reactions occur during the cooking process, some of them may lead to accumulation of toxic products like acrylamide, in such a case, cooking make your food less "safe".
Here some literature on the topic:
http://www.annualreviews.org/doi/pdf/10.1146/annurev-food-041715-033144 http://science.sciencemag.org/content/301/5635/934 http://aem.asm.org/content/71/7/3556.full http://www.sciencedirect.com/science/article/pii/S1878614611001164 https://www.readbyqxmd.com/read/16672493/high-pressure-mediated-survival-of-clostridium-botulinum-and-bacillus-amyloliquefaciens-endospores-at-high-temperature
Just to be clear, I didn't find any scientific paper describing any organism able to survive at 250 C. However 1) it has been shown that spores may survive to dry heat much better than wet heat and some microorganisms have been described to be thriving at more than 120 C. 2) The oven temperature is not the same of the food temperature, in many cases such a heat does not reach the "food core". 3) Unless you cook under a fume-hood, your food gets contaminated as soon you open the oven door.
Staphylococcal food poisoning is super common. The bacteria that cause it are killed by cooking but if they have a chance to grow and make their toxin before they are cooked, the toxin is not destroyed by cooking and can make you sick. I think this type of food poisoning constitutes most cases where you throw up and have diarrhea about 6 hours after you eat but you rally within 2 days.
From linked source (CDC)
People who carry Staph can contaminate food if they don’t wash their hands before touching it. Staph can also be found in unpasteurized milk and cheese products. Because Staph is salt tolerant, it can grow in salty foods like ham. As it multiplies in food, Staph produces toxins. Although Staph bacteria are easily killed by cooking, the toxins are resistant to heat and so cannot be destroyed by cooking. Foods at highest risk of transmitting Staph toxins are those that people handle and then do not cook. Examples are sliced meat, puddings, pastries, and sandwiches. Food contaminated with Staph toxin may not smell bad or look spoiled.
No for several reasons.
If poisonous bacteria previous got into the food, there could be poisons left over that cooking isn't guaranteed to get rid of.
Some bacteria pack themselves into spores when they are cooked. Spores are incredibly hard to destroy. You might consider irradiating them. A common way to counter this: cook food, let it cool (prompting the spores to unpack themselves), then cook it again.
Then you have the risk of "kitchen-to-table" contamination where the food gets contaminated after cooking and cooling due to poor hygiene practices.