I just noticed that the landlord that rented the apartment is not the owner of the flat, he also rented it from somebody else. Is he legally rent it to me?
You should seek competent legal advice on this matter because it may not be as simple to answer. In general terms, you are a "subtenant" and the answer would require looking at the lease agreement that the person you rented from has with the true property owner. The "landlord" that rented the apartment to you may not have approval to do so, or he/she may have been required to obtain the true property owner's consent.